package cn.lanqiao.bigDate.api.config.interceptor;

import cn.lanqiao.common.utils.TokenUtil;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Marisa
 * @description 描述
 * @date 2022/4/27
 */
public class WebInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        String token = request.getHeader("Authorization");
//        System.out.println(token);
//        if(token == null) throw new RuntimeException("token为空");
//        String userName = TokenUtil.getUserName(token);
//        System.out.println(userName);
//        if(userName == null) throw new RuntimeException("token错误或已过期");
        return true;
    }
}
